<?php
session_start();
$id = $_POST['id'];
$a = isset($_SESSION['islogin'])?$_SESSION['islogin']:0;
if ($a!=1) {
	die("<script>alert('请先登陆');window.location.href='xiangqing.php?id=$id'</script>") ;
}
$uname = $_SESSION['uname'];

$content  = $_POST['content'];
$ctime = time();
@mysql_connect('localhost', 'root', 'root');
mysql_select_db('blog');
mysql_set_charset('utf8');
$sql = "insert into `commen` (`commen`,`ctime`,`wid`,`uname`) value ('$content','$ctime','$id','$uname')";
$res = mysql_query($sql);


if ($res) {
    echo "<script>window.location.href='xiangqing.php?id=$id'</script>";
}
